//
//  MHNearByCollectionViewCell.m
//  MiaoCircle
//
//  Created by 许正荣 on 2018/9/21.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHNearByCollectionViewCell.h"
#import "MHNearByModel.h"
#import "MHCustomItemViewModel.h"
@implementation MHNearByCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.distantLabel.font = MHRegularFont_11;
    self.circleNameLabel.font = MHRegularFont_14;
    self.circleMemberLabel.font = MHRegularFont_12;
    self.circleBgImageView.contentMode =  UIViewContentModeScaleAspectFill;
    self.circleBgImageView.masksToBounds = YES;
    
    self.OwnerImageView.contentMode =  UIViewContentModeScaleAspectFill;
    self.OwnerImageView.cornerRadius = 20;
    self.OwnerImageView.layer.masksToBounds = YES;
    self.cornerRadius = 8;
    self.masksToBounds = YES;
    // Initialization code
    self.discovermaskView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"icon_discover_mask"]];
}

-(void)bindViewModel:(MHCustomItemViewModel *)viewModel
{
//    [super ]
    MHNearByModel *model = viewModel.model;
    if (model.distance< 0.1) {
        model.distance = 0.1;
    }
    self.positonLabel.text = model.location.areaName;
    self.distantLabel.text = [NSString stringWithFormat:@"%.1fkm",model.distance];
    self.circleMemberLabel.text = [NSString stringWithFormat:@"%d",model.memberCount];
    self.circleNameLabel.text = model.title;
    [self.circleBgImageView yy_setImageWithURL:[NSURL URLWithString:model.fullCoverUrl] placeholder:MHDefaultAvatar(MHDefaultAvatarTypeDefualt)];
    [self.OwnerImageView yy_setImageWithURL:[NSURL URLWithString:model.fullOwnerFace] placeholder:MHDefaultAvatar(MHDefaultAvatarTypeDefualt)];
}

@end
